package com.jstower.dubbo;

import com.github.pagehelper.PageInfo;
import com.jstower.modules.sample.entity.Sample;
import com.jstower.modules.sample.service.ISampleService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Description:
 * Author: chenshuai
 * Project: js-webzpp
 * Version: V1.0
 * Create Date: 16/4/21
 */
public class Main {

    public static void main(String[] args) throws Exception{
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"classpath:config/dubbo-consumer.xml"});
        context.start();

        ISampleService demoService = (ISampleService)context.getBean("demoService"); // 获取远程服务代理
        PageInfo info = demoService.listSamplePage(1,5); // 执行远程方法

        for (Object arg : info.getList()) {
            Sample sample = (Sample)arg;
            System.out.println(sample); // 显示调用结果
        }
    }
}
